<template>
    <div>
        <el-tabs  >
            <el-tab-pane label="待审核" name="1"></el-tab-pane>
            <el-tab-pane label="待接单" name="2"></el-tab-pane>
            <el-tab-pane label="进行中" name="3"></el-tab-pane>
            <el-tab-pane label="服务人员确认完成" name="4"></el-tab-pane>
            <el-tab-pane label="客户确认完成" name="5"></el-tab-pane>
            <el-tab-pane label="已取消" name="6"></el-tab-pane>
        </el-tabs>
        <el-table
            :data="tableData"
            stripe
            border
            :header-cell-style="TABLE_HEADER_CELL_STYLE"
            v-loading = "isLoading">
            <el-table-column prop='id' label='悬赏id' ></el-table-column>
            <el-table-column prop='title' label='发布者' width="160">
                <template v-slot='scope'>
                    leem(编号：123)
                </template>
            </el-table-column>
            <el-table-column label='发布时间' width="140">
                <template v-slot='scope'>
                    2022/2/23 14:59:12
                </template>
            </el-table-column>
            <el-table-column prop='title' label='悬赏类型'></el-table-column>
            <el-table-column prop='title' label='服务者' width="160">
                <template v-slot='scope'>
                    leem(编号：123)
                </template>
            </el-table-column>
            <el-table-column label='接单时间' width="140">
                <template v-slot='scope'>
                    2022/2/23 14:59:12
                </template>
            </el-table-column>
            <el-table-column prop='title' label='悬赏状态'></el-table-column>
            <el-table-column prop='title' label='赏金' ></el-table-column>
            <el-table-column label="操作" fixed="right" width="300">
                <template v-slot='scope'>
                    <el-button type='text' @click='toDetail(scope.row)'>详情</el-button>
                    <o-table-column-examine :table-row='scope.row'></o-table-column-examine>  
                    <el-popconfirm title="确认转换当前任务的类型吗？" @confirm='transferType(scope.row, true)' class="popconfirm">
                        <el-button type='text' slot="reference">转换类型</el-button>
                    </el-popconfirm>
                    <el-popconfirm title="确认强制取消该悬赏吗？" @confirm='forcedCacnel(scope.row, true)' class="popconfirm">
                        <el-button type='text' slot="reference">强制取消</el-button>
                    </el-popconfirm>
                    <el-popconfirm title="确认强制完成该悬赏吗？" @confirm='forcedFinish(scope.row, true)' class="popconfirm">
                        <el-button type='text' slot="reference">强制完成</el-button>
                    </el-popconfirm>
                    <el-popconfirm title="确认更换当前悬赏的服务人员吗？" @confirm='transferServer(scope.row, true)' class="popconfirm">
                        <el-button type='text' slot="reference">更换服务人</el-button>
                    </el-popconfirm>
                </template>
            </el-table-column>
        </el-table>
        <o-pagination :total='total' @current-change='currentChange'></o-pagination>
    </div>
</template>

<script>
    import {toast, alert} from '@u';
    import oTableColumnExamine from '../../components/global/o-table-column-examine.vue';
    export default {
        components : {
            oTableColumnExamine
        },
        data () {
            return {
                isLoading : false,
                tableData : [{id : 1234567},{id : 222}],
                total : 0,
            }
        },
        created () {
            
        },
        methods : {
            getTableData () {

            },
            currentChange (page) {
                console.log(page);
            },
            //审核通过
            pass (row) {
                this.getTableData();
                document.body.click();
            },
            //审核拒绝
            reject (row) {
                if (!this.examine.reason) {
                    toast('请填写拒绝原因', 'error')
                    return;
                }
                this.getTableData();
                this.examine.reason = null;
                document.body.click();
            },
            //转换任务类型
            transferType (row) {
                 console.log(1);

            },
            //强制取消
            forcedCacnel (row) {

            },
            //强制完成
            forcedFinish (row) {

            },
            //更换服务人员
            transferServer (row) {

            },
            //详情
            toDetail (row) {
                let url = this.$router.resolve({
                    path : `/task/detail/${row.id}`,
                })
                window.open(url.href, '_blank')
            },
        }
    }
</script>

<style>

</style>